[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
VARIABLES
A variable is a location in memory where something is stored. The
contents of a variable can be changed by program code (hence the
name). In SALT, there are two types of variables, integer variables,
and string variables. The former holds an integer value (e.g.,
485624, or -627), while the latter holds a text string (e.g.
"Telix", or "SCRIPT"). Depending on where it is defined, a variable
is either global or local. If a variable is global, it means that it
can be used by any part of the script after the point where it is
defined. If a variable is local, it means that it can only be used
by the part of the script to which it is 'local', for example, the
function inside which it is defined. A variable name can be up to 31
characters long, and may include the letters 'A' to 'Z' or 'a' to 'z',
the digits '0' to '9', or the underscore character (_). The name may
not start with a digit. For example, 'his_name2' and '_his_name2'
are legal as variable names, while '2his_name' is not.
If a variable is defined outside of a function, it is global. If it is
defined inside a function, it is local to that function and will only
be recognized there. If a variable defined inside a function uses
the same name as a global variable, any reference to that name while
in the function will access the local variable. After the function
has completed, the local variable is removed and a reference to that
name will access the global variable.
See Also:
string variable
integer variable
functions
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson